import com.vhly.util.StreamUtil;

import javax.microedition.lcdui.Image;
import java.io.DataInputStream;
import java.io.InputStream;

public class cls_a {

    Image img_a;
    int b;
    int c;
    int d;
    int e;
    int f[][];
    int g[][];
    int h[][];
    int i[][];
    int j[][];
    int k[][];

    cls_a(int l, int i1) {
        a(MainThread.loadUnencodeImage(l), i1);
    }

    cls_a(int l, int i1, int ai[]) {
        a(MainThread.a(l, ai), i1);
    }

    private void a(Image image, int l) {
        img_a = image;
        DataInputStream din = null;
        InputStream in = null;
        try {
            in = Spore.mainThreadImpl.sporeInstance.getClass().getResourceAsStream("/" + l + ".bin");
            din = new DataInputStream(in);
            b = din.readUnsignedByte();
            c = din.readUnsignedByte();
            d = din.readUnsignedByte();  // array sub count
            e = din.readUnsignedByte();  // array count
            // array is array[e][d]
            f = new int[e][];
            g = new int[e][];
            h = new int[e][];
            i = new int[e][];
            j = new int[e][];
            k = new int[e][];
            for (l = 0; l < e; l++) {
                f[l] = new int[d];
                g[l] = new int[d];
                h[l] = new int[d];
                i[l] = new int[d];
                j[l] = new int[d];
                k[l] = new int[d];
                for (int i1 = 0; i1 < d; i1++) {
                    f[l][i1] = din.readUnsignedShort();
                    g[l][i1] = din.readUnsignedShort();
                    h[l][i1] = din.readUnsignedByte();
                    i[l][i1] = din.readUnsignedByte();
                    j[l][i1] = din.readUnsignedByte();
                    k[l][i1] = din.readUnsignedByte();
                }
            }
        }
        catch (Exception ex) {
            StreamUtil.close(din);
            StreamUtil.close(in);
        }
    }
}